package com.huiquan.foundation.constant;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * @Description:权限的ID
 * @author rocky xu
 *
 */
public enum RoleID {

	NONE(-1, "无"),
	
	DEVELOP(0, "开发人员"),

	ADMIN(1, "管理员"),

	DYAD_O_S_CHECK(2, "二元组中o+s"),

	DISEASE_SYMPTOM_O_CHECK(3, "疾病对应o校验黑白名单"),
	
	DISEASE_SYMPTOM_S_CHECK(4, "疾病对应s校验黑白名单"),

	DYAD_S_DE_CHECK(5, "二元组中s+de"),

	DYAD_SI_DE_CHECK(6, "二元组中si+de"),

	OUTSOURCE_XBS_IMAGEOLOGY(7, "外包系统-分词标注器械检查"),

	OUTSOURCE_ADMIN(8, "外包系统-管理员"),

	OUTSOURCE_XBS_IMAGEOLOGY_CHECK(9, "外包系统-器械检查校对员"),

	OUTSOURCE_QA(10, "外包系统-质检"),

	DISEASE_INSPECTION(11, "内部人员指标和相关文章");

	private Integer id;

	private String desc;

	private boolean outsourceFlag;

	public boolean isOutsourceFlag() {
		return outsourceFlag;
	}

	public void setOutsourceFlag(boolean outsourceFlag) {
		this.outsourceFlag = outsourceFlag;
	}

	private RoleID(Integer id, String desc) {
		this.id = id;
		this.desc = desc;

		initOutsourceFlag(super.name());
	}

	private void initOutsourceFlag(String name) {
		List<String> outsourceList = new ArrayList<>();
		outsourceList.add("OUTSOURCE_XBS_IMAGEOLOGY");
		outsourceList.add("OUTSOURCE_ADMIN");
		outsourceList.add("OUTSOURCE_XBS_IMAGEOLOGY_CHECK");
		outsourceList.add("OUTSOURCE_QA");
		
		if (outsourceList.contains(name)) {
			this.outsourceFlag = true;
		} else {
			this.outsourceFlag = false;
		}
	}

	public boolean idEquals(String id) {
		return this.id.equals(id);
	}

	public String getDesc() {
		return desc;
	}

	public Integer getId() {
		return id;
	}

	public static Map<Integer, String> getRoleMap() {

		Map<Integer, String> map = new LinkedHashMap<>();
		for (RoleID at : RoleID.values()) {
			map.put(at.getId(), at.getDesc());
		}
		return map;
	}
}
